use std::path::{Path, PathBuf};

const CONFIG_DIR_PATH: &str = "configs";

const SERVICE_CONFIG_FILE: &str = "service.yaml";
const PACKAGE_LOCAL_CACHE_DIR: &str = ".cache";

const PACKAGES_DIR_PATH: &str = "packages";
const FILE_NAME_LOCAL_JSON: &str = "local_info.json";

const USER_INFO_JSON: &str = "user_info.json";

pub fn get_config_path<'a>() -> &'a Path {
    Path::new(CONFIG_DIR_PATH)
}

pub fn get_packages_path<'a>() -> &'a Path {
    Path::new(PACKAGES_DIR_PATH)
}

pub fn get_cache_path() -> PathBuf {
    let config_path = get_config_path();
    config_path.join(PACKAGE_LOCAL_CACHE_DIR)
}

pub fn get_local_json_path() -> PathBuf {
    let config_path = get_config_path();
    config_path.join(FILE_NAME_LOCAL_JSON)
}

pub fn get_user_info_json_path() -> PathBuf {
    let config_path = get_config_path();
    config_path.join(USER_INFO_JSON)
}

pub fn get_service_config_path() -> PathBuf {
    let config_path = get_config_path();
    config_path.join(SERVICE_CONFIG_FILE)
}
